home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_A / VISASM.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-09-17  |  1.5 KB  |  63 lines

  1. /* $Id: visasm.h,v 1.3 1998/09/04 01:59:48 ecd Exp $ */
  2. #ifndef _SPARC64_VISASM_H
  3. #define _SPARC64_VISASM_H
  4.  
  5. /* visasm.h:  FPU saving macros for VIS routines
  6.  *
  7.  * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
  8.  */
  9.  
  10. #include <asm/pstate.h>
  11. #include <asm/ptrace.h>
  12.  
  13. #define AOFF_task_fpregs    (((ASIZ_task) + 255) & ~255)
  14.  
  15. /* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc */
  16.  
  17. #define VISEntry                    \
  18.     rd        %fprs, %o5;            \
  19.     andcc        %o5, (FPRS_FEF|FPRS_DU), %g0;    \
  20.     be,pt        %icc, 297f;            \
  21.      sethi        %hi(297f), %g7;            \
  22.     ba,pt        %xcc, VISenter;            \
  23.      or        %g7, %lo(297f), %g7;        \
  24. 297:    wr        %g0, FPRS_FEF, %fprs;        \
  25.  
  26. #define VISExit                        \
  27.     wr        %g0, 0, %fprs;
  28.  
  29. /* Clobbers %o5, %g1, %g2, %g3, %g7, %icc, %xcc.
  30.  * Must preserve %o5 between VISEntryHalf and VISExitHalf */
  31.  
  32. #define VISEntryHalf                    \
  33.     rd        %fprs, %o5;            \
  34.     andcc        %o5, FPRS_FEF, %g0;        \
  35.     be,pt        %icc, 297f;            \
  36.      sethi        %hi(298f), %g7;            \
  37.     ba,pt        %xcc, VISenterhalf;        \
  38.      or        %g7, %lo(298f), %g7;        \
  39.     clr        %o5;                \
  40. 297:    wr        %o5, FPRS_FEF, %fprs;        \
  41. 298:
  42.  
  43. #define VISExitHalf                    \
  44.     wr        %o5, 0, %fprs;
  45.  
  46. #ifndef __ASSEMBLY__    
  47. extern __inline__ void save_and_clear_fpu(void) {
  48.     __asm__ __volatile__ ("
  49.         rd %%fprs, %%o5
  50.         andcc %%o5, %0, %%g0
  51.         be,pt %%icc, 299f
  52.          sethi %%hi(298f), %%g7
  53.         ba VISenter    ! Note. This cannot be bp, as it may be too far from VISenter.
  54.          or %%g7, %%lo(298f), %%g7
  55.     298:    wr %%g0, 0, %%fprs
  56.     299:
  57.         " : : "i" (FPRS_FEF|FPRS_DU) :
  58.         "o5", "g1", "g2", "g3", "g7", "cc");
  59. }
  60. #endif
  61.  
  62. #endif /* _SPARC64_ASI_H */
  63.